//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   Gauss_Legendre_1D.hh
 * \author Jeremy Roberts
 * \date   06/19/2011
 * \brief  Gauss_Legendre_1D class definition.
 * \note   Copyright (C) 2011 Jeremy Roberts
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date::                                              $:Date of last commit
//---------------------------------------------------------------------------//

#ifndef GAUSS_LEGENDRE_1D_HH
#define GAUSS_LEGENDRE_1D_HH

#include "angle/Quadrature.hh"

namespace slabtran
{

//===========================================================================//
/*!
 * \class Gauss_Legendre_1D
 * \brief 1D Gauss-Legendre quadrature class.
 *
 * In one dimension, we approximate the scalar flux as
 * \f[
 *   \phi_i = \sum^N_{n=1} w_n \psi_{i,n} \,
 * \f]
 * where the weights \f$ w \f$ sum to 2.  Other moments are similarly defined.
 *
 * The angles \f$ \mu_n \f$ in the Gauss-Legendre approximation for which
   the discrete ordinates equations are solved (see e.g. \ref DD_1D_Equations),
 * are the zeros of the Legendre polynomials.  With appropriate weights,
 * the Gauss-Legendre quadrature can integrate polynomials of order
 * \f$ 2N-1 \f$ exactly.
 */
/*!
 * \example angle/test/tstGauss_Legendre_1D.cc
 *
 * Test of Quadrature.
 */
//===========================================================================//

class Gauss_Legendre_1D : public Quadrature<_1D>
{

private:
	//! Base class typedef.
	typedef Quadrature<_1D> Base;

public:
	// Constructor.
	Gauss_Legendre_1D(int sn_order, double norm);

	// Display the quadrature.
	void display() const;

	// Print quad type
	void name() const { std::cout << "Gauss_Legendre_1D" << std::endl; } ;

private:
	// Generate abscissa and weights for arbitrary order
	void Generate_Parameters( int n, double *x, double *w );
};

} // end namespace slabtran

#endif // GAUSS_LEGENDRE_1D_HH

//---------------------------------------------------------------------------//
//              end of Gauss_Legendre_1D.hh
//---------------------------------------------------------------------------//
